Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pyi file support to .pre-commit-hooks.yaml #1875

Merged
merged 1 commit into from
Dec 31, 2020
Merged

Add pyi file support to .pre-commit-hooks.yaml #1875

merged 1 commit into from
Dec 31, 2020

Conversation

jdufresne
Copy link
Contributor

Since pre-commit 2.9.0 (2020-11-21), the types_or key can be used to
match multiple disparate file types. For more upstream details, see:
pre-commit/pre-commit#607

Fixes #402

Copy link
Collaborator

@ichard26 ichard26 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, many thanks for informing us of the types_or config option! Didn't know that the issue was fixed at last :D

@MarcoGorelli
Copy link
Contributor

Perhaps it would be good to also put

minimum_pre_commit_version: '2.9.0'

@JelleZijlstra
Copy link
Collaborator

Agree with @MarcoGorelli, I'd be worried this causes issues for people running an earlier version of pre-commit.

Since pre-commit 2.9.0 (2020-11-21), the types_or key can be used to
match multiple disparate file types. For more upstream details, see:
pre-commit/pre-commit#607

Add the minimum_pre_commit_version to require pre-commit 2.9.0+.

Fixes #402
@jdufresne
Copy link
Contributor Author

jdufresne commented Dec 20, 2020

Perhaps it would be good to also put: minimum_pre_commit_version

Thank you for this suggestion. I like it.

Included in the latest revision.

The quotes are not necessary as having multiple "." is an invalid number so YAML automatically interprets it as a string.

Copy link
Collaborator

@cooperlees cooperlees left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this fix.

@cooperlees cooperlees merged commit af6f78f into psf:master Dec 31, 2020
@jdufresne jdufresne deleted the pre-commit-types-of branch December 31, 2020 17:10
@@ -8,8 +8,9 @@ repos:
name: black
language: system
entry: black
minimum_pre_commit_version: 2.9.0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2.9.2 would be ever so slightly better -- there was some breaking in 2.9.0-flat related to types_or

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for reviewing and suggesting this. Updated in #1895.

noxan pushed a commit to noxan/black that referenced this pull request Jun 6, 2021
Since pre-commit 2.9.0 (2020-11-21), the types_or key can be used to
match multiple disparate file types. For more upstream details, see:
pre-commit/pre-commit#607

Add the minimum_pre_commit_version to require pre-commit 2.9.0+.

Fixes psf#402
MarcoGorelli added a commit to MarcoGorelli/isort that referenced this pull request Jul 28, 2021
The PR which led to 2.9.0 was made by a data scientist and so it contains a bug in the default types for `types_or`, it'd be better to have 2.9.2 as the minimum version - at least, that's what Anthony Sottile suggested be done in `black` psf/black#1875 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

pre-commit hook does not work for .pyi files
6 participants